package com.study.design.model.createPattern.singleton;

import org.junit.Test;

/**
* @Name: Client
* @Description: 单例模式测试类
* @Author: 李超	lc_jack@foxmail.com
* @CreateDate: 2017-2-9 下午7:11:55 
* @Version: V1.0
 */
public class Client {
	
	/**
	* @Name: testSingleton01
	* @Description: 单例模式饿汉式实现测试
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-2-9 下午7:12:16
	* @Parameters: 
	* @Return: void
	 */
	@Test
	public void testSingleton01() {
		//获取实例化对象
		Singleton01 s01 = Singleton01.getInstance() ;
		Singleton01 s02 = Singleton01.getInstance() ;
		System.out.println(s01);
		System.out.println(s02);
	}
	
	/**
	* @Name: testSingleton02
	* @Description: 单例模式懒汉式实现测试
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-2-9 下午7:29:26
	* @Parameters: 
	* @Return: void
	 */
	@Test
	public void testSingleton02() {
		//获取实例化对象
		Singleton02 s01 = Singleton02.getInstace() ;
		Singleton02 s02 = Singleton02.getInstace() ;
		System.out.println(s01);
		System.out.println(s02);
	}
	
	/**
	* @Name: testSingleton05
	* @Description: 单例模式枚举实现测试
	* @Author: 李超	lc_jack@foxmail.com
	* @Version: V1.0
	* @CreateDate: 2017-2-9 下午8:01:20
	* @Parameters: 
	* @Return: void
	 */
	@Test
	public void testSingleton05() {
		//获取枚举元素
		Singleton05 s01 = Singleton05.INSTANCE ;
		Singleton05 s02 = Singleton05.INSTANCE ;
		System.out.println(s01==s02);
	}

}







